//
//  AddressBookCell.m
//  Shengzhuli
//
//  Created by 卡忙科技 on 16/11/12.
//  Copyright © 2016年 kamangkeji. All rights reserved.
//

#import "AddressBookCell.h"

@interface AddressBookCell()
@property (weak, nonatomic) IBOutlet UILabel *nameLab;
@property (weak, nonatomic) IBOutlet UILabel *tellLab;
@property (weak, nonatomic) IBOutlet UIButton *addBtn;

@end

@implementation AddressBookCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setModel:(AddressBookModel *)model
{
    _model = model;
    self.nameLab.text = model.contactName;
    self.tellLab.text = model.contactPhone;
    if (model.status == 1) {//没有注册
        [self.addBtn setTitle:@"发送短信邀请" forState:UIControlStateNormal];
        self.addBtn.enabled = YES;
        self.addBtn.backgroundColor = RGBColor(67, 213, 255);
        [self.addBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    }else if (model.status == 2) {//是好友
        [self.addBtn setTitle:@"已成为酒友" forState:UIControlStateNormal];
        self.addBtn.enabled = NO;
        self.addBtn.backgroundColor = [UIColor clearColor];
        [self.addBtn setTitleColor:[UIColor grayColor] forState:UIControlStateNormal];
    }else if (model.status == 3) {//不是好友
        [self.addBtn setTitle:@"发送酒友申请" forState:UIControlStateNormal];
        self.addBtn.enabled = YES;
        self.addBtn.backgroundColor = RGBColor(67, 213, 255);
        [self.addBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    }else if (model.status == 4) {//已发送短信邀请
        [self.addBtn setTitle:@"已发送短信邀请" forState:UIControlStateNormal];
        self.addBtn.enabled = YES;
        self.addBtn.backgroundColor = [UIColor clearColor];
        [self.addBtn setTitleColor:[UIColor grayColor] forState:UIControlStateNormal];
    }else {//5 自己定义的 已发送酒友申请
        [self.addBtn setTitle:@"已发送酒友申请" forState:UIControlStateNormal];
        self.addBtn.enabled = YES;
        self.addBtn.backgroundColor = [UIColor clearColor];
        [self.addBtn setTitleColor:[UIColor grayColor] forState:UIControlStateNormal];
    }
}
- (IBAction)btnClick:(UIButton *)btn
{
    if (self.actionBlock) {
        self.actionBlock(btn,self.model);
    }
}

@end
